package br.com.localfloripa.dao;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.transaction.annotation.Transactional;


public abstract class DaoManager<T>  {
	
	@PersistenceContext
	protected EntityManager em;
	

	public void setEm(EntityManager em) {
		this.em = em;
	}
	
	public EntityManager getEm() {
		return this.em;
	}

	@Transactional
	public void persist(T object) throws Exception {
		em.persist(object);
	}
	
	@Transactional
	public void merge(T object) throws Exception {
		em.merge(object);
	}
	
	@Transactional
	public void remove(T object) throws Exception {
		em.remove(object);
	}

}
